// 远程调用返回值
export interface rpcResult {
	seq: number;
	error?: string;
}

export interface Account {
	id: string;
	name: string;
	wxid?: string;
	openConn?: string;
}

export interface Contact {
	id: string;
	name: string;
	alias?: string;
	type?: string;
}

export interface Agent {
	id: string;
	wxid: string;
	readyState?: number;
	type: string;
}

// 服务器接口
interface wxdService {
	// 心跳
	ping(): rpcResult;
	sendControlCommand(id: string, cmd: string): rpcResult;
	getAgent(id: string): rpcResult & Agent;
	requestLogin(id: string, options: Object): rpcResult;
	release(id: string): rpcResult;
	getContacts(id: string): rpcResult & Array<Contact>;
	getRooms(id: string): rpcResult & Array<Contact>;
	sendMessage(id: string, contactId: string, text: string): rpcResult;
	subscribeMessage(id: string, value: boolean): rpcResult;

	getAllAgents(): rpcResult & Array<Agent>;
}

// 客户端接口
interface wxdClient {
	onScan(id: string, qrCode: string);
	onLogin(id: string);
	onLogout(id: string);
	onError(id: string);
	onMessage(id: string, fromId: string, isRoom: boolean, text: string);
}
